<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Class: SMemory</title>
    
    
    
    
    
    <meta property="og:title" content=""/>
    <meta property="og:type" content="website"/>
    <meta property="og:image" content=""/>
    
    <meta property="og:url" content=""/>
    
    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <script src="scripts/jquery.min.js"></script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="styles/jaguar.css">
    
    
    <script>
    var config = {"monospaceLinks":false,"cleverLinks":false,"applicationName":"Jalangi 2","disqus":"","googleAnalytics":"","openGraph":{"title":"","type":"website","image":"","site_name":"","url":""},"meta":{"title":"","description":"","keyword":""},"linenums":true,"default":{}};
    </script>
    

    
</head>
<body>
<div id="wrap" class="clearfix">
    
<div class="navigation">
    <h3 class="applicationName"><a href="index.html">Jalangi 2</a></h3>

    <div class="search">
        <input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations">
    </div>
    <ul class="list">
    
        <li class="item" data-name="MyAnalysis">
            <span class="title">
                <a href="MyAnalysis.html">MyAnalysis</a>
                
            </span>
            <ul class="members itemMembers">
            
            </ul>
            <ul class="typedefs itemMembers">
            
            </ul>
            <ul class="methods itemMembers">
            
            <span class="subtitle">Methods</span>
            
                <li data-name="MyAnalysis#_return"><a href="MyAnalysis.html#_return">_return</a></li>
            
                <li data-name="MyAnalysis#_throw"><a href="MyAnalysis.html#_throw">_throw</a></li>
            
                <li data-name="MyAnalysis#_with"><a href="MyAnalysis.html#_with">_with</a></li>
            
                <li data-name="MyAnalysis#binary"><a href="MyAnalysis.html#binary">binary</a></li>
            
                <li data-name="MyAnalysis#binaryPre"><a href="MyAnalysis.html#binaryPre">binaryPre</a></li>
            
                <li data-name="MyAnalysis#conditional"><a href="MyAnalysis.html#conditional">conditional</a></li>
            
                <li data-name="MyAnalysis#declare"><a href="MyAnalysis.html#declare">declare</a></li>
            
                <li data-name="MyAnalysis#endExecution"><a href="MyAnalysis.html#endExecution">endExecution</a></li>
            
                <li data-name="MyAnalysis#endExpression"><a href="MyAnalysis.html#endExpression">endExpression</a></li>
            
                <li data-name="MyAnalysis#forinObject"><a href="MyAnalysis.html#forinObject">forinObject</a></li>
            
                <li data-name="MyAnalysis#functionEnter"><a href="MyAnalysis.html#functionEnter">functionEnter</a></li>
            
                <li data-name="MyAnalysis#functionExit"><a href="MyAnalysis.html#functionExit">functionExit</a></li>
            
                <li data-name="MyAnalysis#getField"><a href="MyAnalysis.html#getField">getField</a></li>
            
                <li data-name="MyAnalysis#getFieldPre"><a href="MyAnalysis.html#getFieldPre">getFieldPre</a></li>
            
                <li data-name="MyAnalysis#instrumentCode"><a href="MyAnalysis.html#instrumentCode">instrumentCode</a></li>
            
                <li data-name="MyAnalysis#instrumentCodePre"><a href="MyAnalysis.html#instrumentCodePre">instrumentCodePre</a></li>
            
                <li data-name="MyAnalysis#invokeFun"><a href="MyAnalysis.html#invokeFun">invokeFun</a></li>
            
                <li data-name="MyAnalysis#invokeFunPre"><a href="MyAnalysis.html#invokeFunPre">invokeFunPre</a></li>
            
                <li data-name="MyAnalysis#literal"><a href="MyAnalysis.html#literal">literal</a></li>
            
                <li data-name="MyAnalysis#onReady"><a href="MyAnalysis.html#onReady">onReady</a></li>
            
                <li data-name="MyAnalysis#putField"><a href="MyAnalysis.html#putField">putField</a></li>
            
                <li data-name="MyAnalysis#putFieldPre"><a href="MyAnalysis.html#putFieldPre">putFieldPre</a></li>
            
                <li data-name="MyAnalysis#read"><a href="MyAnalysis.html#read">read</a></li>
            
                <li data-name="MyAnalysis#runInstrumentedFunctionBody"><a href="MyAnalysis.html#runInstrumentedFunctionBody">runInstrumentedFunctionBody</a></li>
            
                <li data-name="MyAnalysis#scriptEnter"><a href="MyAnalysis.html#scriptEnter">scriptEnter</a></li>
            
                <li data-name="MyAnalysis#scriptExit"><a href="MyAnalysis.html#scriptExit">scriptExit</a></li>
            
                <li data-name="MyAnalysis#unary"><a href="MyAnalysis.html#unary">unary</a></li>
            
                <li data-name="MyAnalysis#unaryPre"><a href="MyAnalysis.html#unaryPre">unaryPre</a></li>
            
                <li data-name="MyAnalysis#write"><a href="MyAnalysis.html#write">write</a></li>
            
            </ul>
            <ul class="events itemMembers">
            
            </ul>
        </li>
    
        <li class="item" data-name="SMemory">
            <span class="title">
                <a href="SMemory.html">SMemory</a>
                
            </span>
            <ul class="members itemMembers">
            
            </ul>
            <ul class="typedefs itemMembers">
            
            </ul>
            <ul class="methods itemMembers">
            
            <span class="subtitle">Methods</span>
            
                <li data-name="SMemory#getActualObjectOrFunctionFromShadowObjectOrFrame"><a href="SMemory.html#getActualObjectOrFunctionFromShadowObjectOrFrame">getActualObjectOrFunctionFromShadowObjectOrFrame</a></li>
            
                <li data-name="SMemory#getFrame"><a href="SMemory.html#getFrame">getFrame</a></li>
            
                <li data-name="SMemory#getIDFromShadowObjectOrFrame"><a href="SMemory.html#getIDFromShadowObjectOrFrame">getIDFromShadowObjectOrFrame</a></li>
            
                <li data-name="SMemory#getShadowFrame"><a href="SMemory.html#getShadowFrame">getShadowFrame</a></li>
            
                <li data-name="SMemory#getShadowObject"><a href="SMemory.html#getShadowObject">getShadowObject</a></li>
            
                <li data-name="SMemory#getShadowObjectOfObject"><a href="SMemory.html#getShadowObjectOfObject">getShadowObjectOfObject</a></li>
            
            </ul>
            <ul class="events itemMembers">
            
            </ul>
        </li>
    
    </ul>
</div>
    <div class="main">
        <h1 class="page-title" data-filename="SMemory.html">Class: SMemory</h1>
        



<section>
    
<header>
    <h2>
    SMemory
    </h2>
    
</header>  

<article>
    <div class="container-overview">
    
    
    
        
<dt>
    <div class="nameContainer">
        <h4 class="name" id="SMemory">
            
            new SMemory<span class="signature">()</span>
        </h4>
    
        
        <div class="tag-source">
            <a href="global.html#SMemory.js">SMemory.js</a>, <a href="global.html#SMemory.js#line29">line 29</a>
        </div>
        
    </div>

    
</dt>
<dd>
    
    
    <div class="description">
        <p>
SMemory associates a unique object with every JavaScript object, function, and activation frame during an execution.
(Note that a shadow object cannot associated with primitive values, undefined, or null.)  A shadow object can be used
to store meta-information about an object (e.g. the location at which the object was created).  Each shadow
object has an unique id, which can be treated as the logical address of the corresponding JavaScript object or
activation frame.
<p>
To use smemory, one must include --analysis $JALANGI_HOME/src/js/sample_analyses/ChainedAnalyses.js
--analysis $JALANGI_HOME/src/js/runtime/SMemory.js as the first two --analysis options during an analysis.
smemory can be accessed via J$.smemory or sandbox.smemory.  The smemory object defines several methods.
Those methods can be used to obtain the shadow memory for an object property or a program variable,
respectively.  getShadowObject should be used in getFieldPre, putFieldPre, and literal callbacks.  (In a literal
callback with an object literal, one must go over all the own properties of the literal object to suitably update
shadow object.) getShadowFrame should only be used in declare, read, and write callbacks.
<p>
    </div>
    

    
    
    
    
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
</dl>

    
    

    

    
    
    
    
    
    
    
</dd>

    
    </div>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        <h3 class="subsection-title">Methods</h3>
        
        <dl>
            
<dt>
    <div class="nameContainer">
        <h4 class="name" id="getActualObjectOrFunctionFromShadowObjectOrFrame">
            
            getActualObjectOrFunctionFromShadowObjectOrFrame<span class="signature">(obj)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{*}</span>
        </h4>
    
        
        <div class="tag-source">
            <a href="global.html#SMemory.js">SMemory.js</a>, <a href="global.html#SMemory.js#line115">line 115</a>
        </div>
        
    </div>

    
</dt>
<dd>
    
    
    <div class="description">
        Given a shadow object, it returns the actual object.
Given a shadow frame, it returns the function whose invocation created the frame.
    </div>
    

    
    
    
    
    
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>obj</code></td>
            
            
            <td class="type">
            
            </td>
            
            
            
            <td class="description last">
                
                </td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
</dl>

    
    

    

    
    
    
    
    
    <h5>Returns:</h5>
    


<table class="params">
    <thead>
    <tr>
        
        <th>Type</th>
        <th class="last">Description</th>
    </tr>
    </thead>
    <tbody>
    
        <tr>
            
            <td class="type">
            
                        *
                        
                    
            </td>
            <td class="description last"></td>
        </tr>
    
    </tbody>
</table>

    
    
    
</dd>

        
            
<dt>
    <div class="nameContainer">
        <h4 class="name" id="getFrame">
            
            getFrame<span class="signature">(name)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Object}</span>
        </h4>
    
        
        <div class="tag-source">
            <a href="global.html#SMemory.js">SMemory.js</a>, <a href="global.html#SMemory.js#line127">line 127</a>
        </div>
        
    </div>

    
</dt>
<dd>
    
    
    <div class="description">
        This method returns the shadow object associated with the activation frame that contains the variable "name".  To get the current activation frame,
call J$.smemory.getFrame("this");
    </div>
    

    
    
    
    
    
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>name</code></td>
            
            
            <td class="type">
            
            </td>
            
            
            
            <td class="description last">
                
                Name of the variable whose owner activation frame's shadow object we want to retrieve</td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
</dl>

    
    

    

    
    
    
    
    
    <h5>Returns:</h5>
    


<table class="params">
    <thead>
    <tr>
        
        <th>Type</th>
        <th class="last">Description</th>
    </tr>
    </thead>
    <tbody>
    
        <tr>
            
            <td class="type">
            
                        Object
                        
                    
            </td>
            <td class="description last">-  The shadow object of the activation frame owning the variable.</td>
        </tr>
    
    </tbody>
</table>

    
    
    
</dd>

        
            
<dt>
    <div class="nameContainer">
        <h4 class="name" id="getIDFromShadowObjectOrFrame">
            
            getIDFromShadowObjectOrFrame<span class="signature">(obj)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{number|undefined}</span>
        </h4>
    
        
        <div class="tag-source">
            <a href="global.html#SMemory.js">SMemory.js</a>, <a href="global.html#SMemory.js#line102">line 102</a>
        </div>
        
    </div>

    
</dt>
<dd>
    
    
    <div class="description">
        Given a shadow object or frame, it returns the unique id of the shadow object or frame.  It returns undefined,
if obj is undefined, null, or not a valid shadow object.
    </div>
    

    
    
    
    
    
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>obj</code></td>
            
            
            <td class="type">
            
            </td>
            
            
            
            <td class="description last">
                
                </td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
</dl>

    
    

    

    
    
    
    
    
    <h5>Returns:</h5>
    


<table class="params">
    <thead>
    <tr>
        
        <th>Type</th>
        <th class="last">Description</th>
    </tr>
    </thead>
    <tbody>
    
        <tr>
            
            <td class="type">
            
                        number
                         | 
                    
                        undefined
                        
                    
            </td>
            <td class="description last"></td>
        </tr>
    
    </tbody>
</table>

    
    
    
</dd>

        
            
<dt>
    <div class="nameContainer">
        <h4 class="name" id="getShadowFrame">
            
            getShadowFrame<span class="signature">(name)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Object}</span>
        </h4>
    
        
        <div class="tag-source">
            <a href="global.html#SMemory.js">SMemory.js</a>, <a href="global.html#SMemory.js#line81">line 81</a>
        </div>
        
    </div>

    
</dt>
<dd>
    
    
    <div class="description">
        This method returns the shadow object associated with the activation frame that contains the variable "name".
    </div>
    

    
    
    
    
    
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>name</code></td>
            
            
            <td class="type">
            
            </td>
            
            
            
            <td class="description last">
                
                Name of the variable whose owner activation frame's shadow object we want to retrieve</td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
</dl>

    
    

    

    
    
    
    
    
    <h5>Returns:</h5>
    


<table class="params">
    <thead>
    <tr>
        
        <th>Type</th>
        <th class="last">Description</th>
    </tr>
    </thead>
    <tbody>
    
        <tr>
            
            <td class="type">
            
                        Object
                        
                    
            </td>
            <td class="description last">-  The shadow object of the activation frame owning the variable.</td>
        </tr>
    
    </tbody>
</table>

    
    
    
</dd>

        
            
<dt>
    <div class="nameContainer">
        <h4 class="name" id="getShadowObject">
            
            getShadowObject<span class="signature">(obj, prop, isGetField)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Object}</span>
        </h4>
    
        
        <div class="tag-source">
            <a href="global.html#SMemory.js">SMemory.js</a>, <a href="global.html#SMemory.js#line66">line 66</a>
        </div>
        
    </div>

    
</dt>
<dd>
    
    
    <div class="description">
        This method should be called on a base object and a property name to retrieve the shadow object associated with
the object that actually owns the
property. When the program performs a putField operation, the third argument should be false and the returned
object is the shadow object associated with the base object.  When the program performs a getField operation,
the third argument should be true and the returned object is the shadow object associated with the object in the
prototype chain (or the base object) which owns the property.  For a getField operation, the returned value
is undefined if none of the
objects in the prototype chain owns the property.  The return value is an object with two properties: "owner"
points to the shadow object and "isProperty" indicates if the property is a concrete property of the object or
if the property denotes a getter/setter.
    </div>
    

    
    
    
    
    
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>obj</code></td>
            
            
            <td class="type">
            
            </td>
            
            
            
            <td class="description last">
                
                The base object</td>
        </tr>
	
	
	
        <tr>
            
                <td class="name"><code>prop</code></td>
            
            
            <td class="type">
            
            </td>
            
            
            
            <td class="description last">
                
                The property name</td>
        </tr>
	
	
	
        <tr>
            
                <td class="name"><code>isGetField</code></td>
            
            
            <td class="type">
            
            </td>
            
            
            
            <td class="description last">
                
                True if the property access is a getField operation</td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
</dl>

    
    

    

    
    
    
    
    
    <h5>Returns:</h5>
    


<table class="params">
    <thead>
    <tr>
        
        <th>Type</th>
        <th class="last">Description</th>
    </tr>
    </thead>
    <tbody>
    
        <tr>
            
            <td class="type">
            
                        Object
                        
                    
            </td>
            <td class="description last"></td>
        </tr>
    
    </tbody>
</table>

    
    
    
</dd>

        
            
<dt>
    <div class="nameContainer">
        <h4 class="name" id="getShadowObjectOfObject">
            
            getShadowObjectOfObject<span class="signature">(val)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Object|undefined}</span>
        </h4>
    
        
        <div class="tag-source">
            <a href="global.html#SMemory.js">SMemory.js</a>, <a href="global.html#SMemory.js#line148">line 148</a>
        </div>
        
    </div>

    
</dt>
<dd>
    
    
    <div class="description">
        This method returns the shadow object associated with the argument.  If the argument cannot be associated with a shadow
object, the function returns undefined.
    </div>
    

    
    
    
    
    
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>val</code></td>
            
            
            <td class="type">
            
            </td>
            
            
            
            <td class="description last">
                
                The object whose shadow object the function returns</td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
</dl>

    
    

    

    
    
    
    
    
    <h5>Returns:</h5>
    


<table class="params">
    <thead>
    <tr>
        
        <th>Type</th>
        <th class="last">Description</th>
    </tr>
    </thead>
    <tbody>
    
        <tr>
            
            <td class="type">
            
                        Object
                         | 
                    
                        undefined
                        
                    
            </td>
            <td class="description last">- Returns the shadow object associated with val.  Return undefined if there is no shadow object assocaited with val
Note that a shadow object cannot be associated with a primitive value: number, string, boolean, undefined, or null.</td>
        </tr>
    
    </tbody>
</table>

    
    
    
</dd>

        </dl>
    
    
    
    
    
</article>

</section>  





        

        <footer>
            Documentation generated by <a target="_blank" href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Fri Jun 10 2016 17:20:03 GMT-0700 (PDT)
        </footer>
    </div>
</div>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/main.js"></script>
</body>
</html>